﻿using System;

namespace Bpms.Cache
{
    /// <summary>
    /// 公共缓存策略接口
    /// </summary>
    public interface ICacheStrategy
    {
        /// <summary>
        /// 添加指定ID的对象
        /// </summary>
        /// <param name="objectId"></param>
        /// <param name="objectValue"></param>
        void AddObject(string objectId, object objectValue);

        /// <summary>
        /// 添加指定ID的对象(关联指定文件组)
        /// </summary>
        /// <param name="objectId"></param>
        /// <param name="objectValue"></param>
        /// <param name="files"></param>
        void AddObjectWithFileChange(string objectId, object objectValue, string[] files);

        /// <summary>
        /// 添加指定ID的对象(关联指定键值组)
        /// </summary>
        /// <param name="objectId"></param>
        /// <param name="objectValue"></param>
        /// <param name="dependKey"></param>
        void AddObjectWithDepend(string objectId, object objectValue, string[] dependKey);

        /// <summary>
        /// 移除指定ID的对象
        /// </summary>
        /// <param name="objectId"></param>
        void RemoveObject(string objectId);

        /// <summary>
        /// 返回指定ID的对象
        /// </summary>
        /// <param name="objectId"></param>
        /// <returns></returns>
        object RetrieveObject(string objectId);

        /// <summary>
        /// 到期时间
        /// </summary>
        int TimeOut { set; get; }

        /// <summary>
        /// 缓存日志功能扩展
        /// </summary>
        /// <param name="logger">日志类实例</param>
        void Accept(Bpms.Log.LogAdapter logger);
    }
}
